package net.huashitong.scheduling.utils;

import com.sirdc.modules.utils.ObjectUtils;

public class AnticipatoryComputingUtils {
     
	private Double gdpCumulative;  //GDP累计值
	private Double gdpRotio;       //Gdp累计增长率
	private Double firstCumulative;  //第一产业累计值
	private Double firstRotio;       //第一产业增长率
	private Double secondCumulative;  //第二产业累计值
	private Double secondRotio;      //第二产业增长率
    private Double thirdlyCumulative; //第三产业累计值
    private Double thirdlyRotio;      //第三产业增加率
    
	public Double getGdpCumulative() {
		if(ObjectUtils.isBlank(this.firstCumulative)){
			this.firstCumulative=0.0;
		}
		if(ObjectUtils.isBlank(this.secondCumulative)){
			this.secondCumulative=0.0;
		}
		if(ObjectUtils.isBlank(this.thirdlyCumulative)){
			this.thirdlyCumulative=0.0;
		}
		return gdpCumulative=this.firstCumulative+this.secondCumulative+this.thirdlyCumulative;
	}
    public void setGdpCumulative(Double gdpCumulative) {
		this.gdpCumulative = gdpCumulative;
	}
    public Double getGdpRotio() {
		return gdpRotio;
	}

    public void setGdpRotio(Double gdpRotio) {
		this.gdpRotio = gdpRotio;
	}

    public Double getFirstCumulative() {
		return firstCumulative;
	}

    public void setFirstCumulative(Double firstCumulative) {
		this.firstCumulative = firstCumulative;
	}

    public Double getFirstRotio() {
		return firstRotio;
	}

    public void setFirstRotio(Double firstRotio) {
		this.firstRotio = firstRotio;
	}

    public Double getSecondCumulative() {
		return secondCumulative;
	}

    public void setSecondCumulative(Double secondCumulative) {
		this.secondCumulative = secondCumulative;
	}

    public Double getSecondRotio() {
		return secondRotio;
	}
    
    public void setSecondRotio(Double secondRotio) {
		this.secondRotio = secondRotio;
	}
    
    public Double getThirdlyCumulative() {
		return thirdlyCumulative;
	}
	public void setThirdlyCumulative(Double thirdlyCumulative) {
		this.thirdlyCumulative = thirdlyCumulative;
	}
	
	public Double getThirdlyRotio() {
		return thirdlyRotio;
	}
	public void setThirdlyRotio(Double thirdlyRotio) {
		this.thirdlyRotio = thirdlyRotio;
	}
	
	//增长率=本年不变累计值/去年不变累计值*100-100
	public Double getRotioCalculate(Double currentCumulative,Double lastYearCumulative){
		return currentCumulative/lastYearCumulative*100-100;
	}
	//本年增加值（不变价）=上年增加值（不变价）*（本年增速（不变价）+100）/100
    public Double getCurrentInvariant(Double lastYearCumulative,Double rotio){
    	return lastYearCumulative*(rotio+100)/100;
    }
	//本年增加值（现价）=本年换算系数*本年增加值（不变价）/100
    public Double getCurrentPrice(Double currentInvariant,Double conversionRatio){
    	return conversionRatio*currentInvariant/100;
    }
     
     
    
	public static void main(String[] args) {
		AnticipatoryComputingUtils s=new AnticipatoryComputingUtils();
		 s.setFirstCumulative(1.0);
		 s.setSecondCumulative(2.0);
		 s.setThirdlyCumulative(3.0);
		 System.out.println("s="+s.getGdpCumulative());
    }	   
}
